import Utf8 from 'crypto-js/enc-utf8';
import Base64 from 'crypto-js/enc-base64';

/**
 * base64 编码
 * @param utf8Str
 * @returns
 */
export var encodeBase64 = function encodeBase64(utf8Str) {
  var wordArray = Utf8.parse(utf8Str);
  return Base64.stringify(wordArray);
};

/**
 * base64 解码
 * @param base64Str
 * @returns
 */
export var decodeBase64 = function decodeBase64(base64Str) {
  var wordArray = Base64.parse(base64Str);
  return Utf8.stringify(wordArray);
};